﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CalculatePoints.aspx.cs" Inherits="Manager_User_PageData_CalculatePoints" MasterPageFile="~/Manager/User/PageData/MasterPage.master" %>
<asp:Content ID="Head" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
    <script type="text/javascript" src="../../../js/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        var isrunning = false;
        var running = null;
        $(document).ready(function () {
            $("#btnStop").attr("disabled", true);
            $("#btnStop").click(function () {
                if (running != null)
                    clearInterval(running);
                $(this).attr("disabled", true);
                $("#btnStart").attr("disabled", false);
                var url = "../RequestHandler.ashx?v=1.0&action=s1u&ut=um&tagmode=any&format=json&jsoncallback=&status=0";
                $.post(url, function (data) {

                });
            });
            $("#btnStart").click(function () {
                dispLog("");
                $(this).attr("disabled", true);
                $("#btnStop").attr("disabled", false);
                var url = "../RequestHandler.ashx?v=1.0&action=s1u&ut=um&tagmode=any&format=json&jsoncallback=&status=1";
                $.post(url, function (data) {
                    dispLog(data);
                    isrunning = true;
                    running = setInterval(runLoop, 10);
                });
            });
        });
        function runLoop() {
            if (isrunning == false) return;
            var url = "../RequestHandler.ashx?v=1.0&action=s1u&ut=um&tagmode=any&format=json&jsoncallback=&status=3";
            $.post(url, function (data) {
                if (data == -1) {
                    $("#btnStop").attr("disabled", true);
                    $("#btnStart").attr("disabled", false);
                    clearInterval(running);
                    running = false;
                } else {
                    dispLog(data);
                }
            });
        }
        function dispLog(log) {$("#logs").val(log);}
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="images/tab_03.gif" width="15" height="30" /></td>
        <td width="1101" background="images/tab_05.gif"><img alt="" src="images/a.gif" width="16" height="16" /> <span class="STYLE4">积分结算</span></td>
        <td width="281" background="images/tab_05.gif"><table border="0" align="right" cellpadding="0" cellspacing="0">
            <tr>
              <td width="60"><table width="87%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="STYLE1"><div align="center">
                    </div></td>
                    <td class="STYLE1"><div align="center"></div></td>
                  </tr>
              </table></td>
              
              <td width="52"><table width="88%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="STYLE1"><div align="center"></div></td>
                    <td class="STYLE1"><div align="center"><a href="#" onclick="delAll()"></a></div></td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
        <td width="14"><img alt="" src="images/tab_07.gif" width="14" height="30" /></td>
      </tr>
    </table></td>
  </tr>

   <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9" background="images/tab_12.gif">&nbsp;</td>
        <td bgcolor="#f3ffe3">
        <table width="50%" border="0" align="center" cellpadding="0" cellspacing="1">
            <tr><td width="8%">&nbsp;</td></tr>
           <tr>
            <td width="8%"><input type="button" id="btnStart" class="STYLE_BUTTON" value="开始结算" style="width:100px; height:30px"/>&nbsp;&nbsp;<input type="button" style="width:100px; height:30px" id="btnStop" class="STYLE_BUTTON" value="停止结算"/></td>
          </tr>
          <tr><td width="8%">&nbsp;</td></tr>
          <tr>
            <td width="8%"><textarea id="logs" rows="30" cols="120" readonly="readonly"></textarea></td>
          </tr>
        </table></td>
        <td width="9" background="images/tab_16.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="images/tab_20.gif" width="15" height="29" /></td>
        <td background="images/tab_21.gif" width="100%"></td>
        <td width="14"><img alt="" src="images/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</asp:Content>